#include <stdio.h>

int count;

int jud1(int s[])
{
    int i,l;
    for(l = 1;l < 4 ; l++)
    for(i = l + 1;i < 5; ++i)
    if(s[l] == s[i])
    return 0;
    return 1;
}

void print(int u[])
{
    int k;
    printf("\nNo.%d:",++count);
    for(k = 0 ;k < 6 ;k++)
    if(k % 3 == 0)
    printf("\n%d",u[k]);
    else
    printf("%d",u[k]);
}

int main()
{
    static int a[] = {1,2,3,4,5,6};
    printf("The possible table satisfied above conditions are:\n");
    for(a[1] = a[0] + 1;a[1] <= 5;++a[1])
    for(a[2] = a[1] + 1;a[2] <= 5;++a[2])
    for(a[3] = a[0] + 1;a[3] <= 5;++a[3])
    for(a[4] = a[1] > a[3]?a[1]+1:a[3]+1;a[4] <= 5;++a[4])
    if(jud1(a))
    print(a);
    printf("\n");
}

